import request from '@/utils/request'
import type { AccountResponse, accountRequestData } from './types/account'
import {AddDepartmentParams, CommonResponse} from "@/api/types/department";

enum API {
    LOGIN_URL = '/account/systeruser'
}

export const getAccountList = () => {
    return request.get<AccountResponse, AccountResponse>('/account/systeruser')
}


//添加账号
export const addAccountList = (params: any) => {
    const formData = new FormData()
    formData.append('username', params.username)
    formData.append('password', params.password)
    return request.post<AccountResponse, AccountResponse>('/account/systeruser', formData)
}


//改密码
export const updateAccountList = (params: any) => {
    const formData = new FormData()
    formData.append('username', params.username)
    formData.append('password', params.password)
    return request.put<AccountResponse, AccountResponse>('/account/systeruser', formData)
}
//校验存在
export const valAccountList = (data:any) => {
    return request.get<AccountResponse, AccountResponse>(
        `${API.LOGIN_URL}?username=${data}`
    )
}
